<ion-header>
  <ion-navbar color="primary">
    <ion-title>登录</ion-title>
    <ion-buttons start>
      <button ion-button (click)="dismiss()">
        <ion-icon name='arrow-back'></ion-icon>
      </button>
    </ion-buttons>
    <ion-buttons end>
      <button  ion-button (click)="register()">注册</button>
    </ion-buttons>
  </ion-navbar>
</ion-header>

<ion-content>
  <form [formGroup]="loginForm" class="form" novalidate>
    <ion-item>
      <ion-label>手机号</ion-label>
      <ion-input type="text" [formControl]="user_phone"></ion-input>
      <button [disabled]="!user_phone.valid" (click)="sendCode()" small item-right clear color="danger" ion-button>发送验证码</button>
    </ion-item>
    <ion-item>
      <ion-label>验证码</ion-label>
      <ion-input type="text" [formControl]="phone_code"></ion-input>
    </ion-item>
    <p padding-left>*未注册过的手机号将自动注册为分答账号</p>
    <div padding-horizontal><button (click)="login(loginForm.value)" ion-button block color="danger" [disabled]="!loginForm.valid">登录</button></div>
  </form>
</ion-content>
